package org.frog.sgs.server.msg;

import java.io.IOException;
import java.util.List;

import org.frog.sgs.card.general.General;
import org.frog.sgs.event.SgsEventCode;
import org.frog.sgs.io.SgsMsg;

/**
 * @author duanxiangqi
 * @date 2012-10-26
 */
public class ServerMsgGenerals extends SgsMsg {

	private static final long serialVersionUID = -3194850296731511971L;

	public ServerMsgGenerals(List<General> generals) {
		super(SgsEventCode.CHOOSE_GENERAL);
		try {
			writeInt(generals.size());
			for (General general : generals) {
				writeInt(general.getId());
				writeString(general.getName());
			}
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
}
